//
//  HistoryHeader.m
//  LabanBrowser
//
//  Created by -Xh- on 3/11/13.
//  Copyright (c) 2013 VNG. All rights reserved.
//

#import "HistoryHeader.h"

@implementation HistoryHeader
@synthesize delegate;
@synthesize currentSectionIndex;
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}

-(void)initialize{
    [self.triggerButton initialize];
    [self.triggerButton setImageOne:[UIImage imageNamed:@"expand.png"] AndImageTwo:[UIImage imageNamed:@"collapse.png"]];
    self.triggerButton.delegate=self;
    self.backgroundIMV.backgroundColor=[UIColor scrollViewTexturedBackgroundColor];
    
    int currentThemeIndex= [[[[StaticVariables shareVariables]userDefaults]theme]intValue];
    UIColor* currentThemeColor=[[[StaticVariables shareVariables]presetThemes]objectAtIndex:currentThemeIndex];
    self.backgroundOverlayIMV.backgroundColor=currentThemeColor;
    self.backgroundOverlayIMV.alpha=[[[StaticVariables shareVariables]constantValues]themeAlpha];
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/
-(void)onTouchStateOne:(UIButton *)_button{
    [self.triggerButton swapState];
    if(delegate && [delegate respondsToSelector:@selector(onExpandHeader:)]){
        [delegate onExpandHeader:self];
    }
}
-(void)onTouchStateTwo:(UIButton *)_button{
    [self.triggerButton swapState];
    if(delegate && [delegate respondsToSelector:@selector(onCollapseHeader:)]){
        [delegate onCollapseHeader:self];
    }
}

@end
